# -*- encoding=utf8 -*-
"""
RedFlag-TC000007   素材排序
选择素材进行排序
"""
__author__ = "ldm"

import sys
import os


# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()
log("---------------------------------------------进行素材排序---------------------------------------------------------")
# 进入相册
shooter.enter_album()
# 点击视频
shooter.click_element(album_video_list)
# 选择视频列表第一个素材
shooter.click_element(album_select_button)
# 点击照片
shooter.click_element(album_photo_list)
# 选择照片列表第一个素材
shooter.click_element(album_select_button1)
# 通过坐标移动素材顺序
preview_bar_elow[1].drag_to(preview_bar_elow[0])
# 获取选择视频文本信息
shooter.click_element(album_video_list)
text = shooter.get_element_text(album_select_button, 0, "cn.migu.video.clip.walle:id/clip_ed_file_check_img", "cn.migu.video.clip.walle:id/clip_ed_order_tv")
# 断言
text1 = "2"
shooter.assert_texts_equal(text, text1, "断言失败，比对值不正确")
#关闭应用
stop_app(UGC_package_name)